home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v17n03 / ucrasm.exe / SHELL.ASM < prev    next >
Encoding:
Assembly Source File  |  1991-10-23  |  1.6 KB  |  94 lines

  1.         include     stdlib.a
  2.         includelib    stdlib.lib
  3. ;
  4. ;
  5. ; Global variables go here:
  6. ;
  7. dseg        segment    para public 'data'
  8. ;
  9. ;
  10. dseg        ends
  11. ;
  12. ;
  13. ;
  14. ;
  15. cseg        segment    para public 'code'
  16.         assume    cs:cseg, ds:dseg
  17. ;
  18. ;
  19. lesi        macro    adrs
  20.         mov     di, seg adrs
  21.         mov    es, di
  22.         lea    di, adrs
  23.         endm
  24. ;
  25. ldxi        macro    adrs
  26.         mov    dx, seg adrs
  27.         lea    si, adrs
  28.         endm
  29. ;
  30. ; Variables that wind up being used by the standard library routines.
  31. ; The MemInit routine uses "PSP" and "zzzzzzseg" labels.  They must be
  32. ; present if you intend to use getenv, MemInit, malloc, and free.
  33. ;
  34. ;
  35.         public    PSP
  36. PSP        dw    ?
  37. ;
  38. cr        equ    13
  39. lf        equ    10
  40. ;
  41. ;
  42. ;--------------------------------------------
  43. ; Here is a good place to put other routines:
  44. ;
  45. ;
  46. ;
  47. ;
  48. ;-----------------------------------------------------------------
  49. ; Main is the main program.  Program execution always begins here.
  50. ;
  51. Main        proc
  52.         mov    cs:PSP, es        ;Save pgm seg prefix
  53.         mov    ax, seg dseg        ;Set up the segment registers
  54.         mov    ds, ax
  55.         mov    es, ax
  56. ;
  57.         mov    dx, 0
  58.         meminit
  59. ;
  60. ;***************************************************************************
  61. ;
  62. ; Put your main program here.
  63. ;
  64. ;***************************************************************************
  65. ;
  66. ;
  67. ;
  68. Quit:        mov     ah, 4ch
  69.         int     21h
  70. ;
  71. ;
  72. Main        endp
  73. ;
  74. ;
  75. ;
  76. ;
  77. cseg            ends
  78. ;
  79. ;
  80. ; Allocate a reasonable amount of space for the stack (2k).
  81. ;
  82. sseg        segment    para stack 'stack'
  83. stk        db    256 dup ("stack   ")
  84. sseg        ends
  85. ;
  86. ;
  87. ;
  88. ; zzzzzzseg must be the last segment that gets loaded into memory!
  89. ;
  90. zzzzzzseg    segment    para public 'zzzzzz'
  91. LastBytes    db    16 dup (?)
  92. zzzzzzseg    ends
  93.         end    Main
  94.